
import 'package:myturngame/bean/role_in_combat.dart';
import 'package:myturngame/common/game_global.dart';

import 'combat/damage.dart';

///被动效果
class PassiveEffect{
  String name;

  PassiveEffect(this.name);

  void effect(Damage damage,RoleInCombat target){
    if(name == 'effect001'.effectName()){
      //割裂伤害累加效果
      var effectName = 'effect001'.effectName();
      var oldValue = target.deBuff[effectName];
      if(oldValue!=null){
        target.deBuff[effectName] = oldValue + 5;
        damage.addUpValue = oldValue + 5;
      }else{
        target.deBuff[effectName] = 5;
        damage.addUpValue = 5;
      }
    }else if(name == 'effect002'.effectName()){
      //削血，暴击时直接削减百分比生命值
      if(damage.isCritical){
        damage.addUpValue = target.role.hp ~/ 10;
      }
    }
  }
}